-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional binary relocatability #1414
Conversation
cc @xela-95 @mjcarroll I guess the bazel build system needs to be adapted to this change, do you have any pointer on how I could do that? Thanks! |
Signed-off-by: Silvio Traversaro <[email protected]>
Friendly ping @mjcarroll, thanks! |
changes look good to me. Perhaps we can get this in first and adapt the changes to bzl as a follow-on task? |
Ok for me! |
I've started seeing windows builds of downstream packages fail since this was merged:
|
@@ -91,6 +109,11 @@ if (BUILD_TESTING) | |||
-DGZ_SDFORMAT_STATIC_DEFINE | |||
) | |||
|
|||
if(WIN32) | |||
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} | |||
PRIVATE shlwapi) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this needs to be public?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually this target_link_libraries
call is inside if (BUILD_TESTING)
, but it should no depend on the value of BUILD_TESTING
. I'll submit a PR shortly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix in #1468
The note on the |
Originally this was done to avoid to link |
Gazebo Harmonic and up don't support 20.04, so yeah, we could copy the gz-common joinPaths implementation with |
Closes part of gazebosim/gz-sim#626
Summary
This PR uses the changes introduced in gz-cmake3 in gazebosim/gz-cmake#334 to support the cmake installation directory to be moved after the
make install
prefix, and continue to work without the need to set any special environment variable, as long as the library is compiled as shared. To avoid regressions and problems in Ubuntu Focal due to the use of std::filesystem, this new behaviour is only activated if theGZ_ENABLE_RELOCATABLE_INSTALL
option is enabled, and its default value isOFF
.In particular, this PR defines a
sdf::getSharePath()
function that should be used in place of theSDF_SHARE_PATH
macro to ensure that the library is relocatable.Furthermore, this PR also deprecates the
SDF_SHARE_PATH
macro, using the strategy described in https://stackoverflow.com/a/29297970 . That strategy works fine on GCC and Clang, while on MSVC it raise a warning:However, I think that it does anyhow the job of raising some kind of warning, and then at soon as the developer checks the macro definition the kind of warning is clear.
The PR also deprecates the
SDF_VERSION_PATH
macro without providing any replacement. This is done as at the moment theSDF_VERSION_PATH
points to a non-existent directory:so I guess it is mostly unused, and it can be safely deprecated.
Similarly to gazebosim/gz-physics#507, a local copy of
joinPaths
is imported to avoid to add a dependency ongz-common
.Test it
The test should work as usual. The used CMake machinery is tested in gazebosim/gz-cmake#334 .
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.